import React, { Component } from 'react';
import { Link, routerRedux } from 'dva/router';
import { connect } from 'dva';
import { List, InputItem,  Toast, Flex,Icon,WingBlank,Button,Grid} from 'antd-mobile';
import NavTopBar from '../../components/NavTopBar/NavTopBar';
import select2 from '../../assets/img/select2.svg';
import select1 from '../../assets/img/select1.svg';
// import Img from "../../components/Img/Img";
import titlesvg from "../../assets/img/title.svg";
import paySuccesssvg from "../../assets/img/paySuccess.svg";
import MyScroll from "../../components/MyScroll/MyScroll";
import RecommendGoods from "../../components/RecommendGood/RecommendGoods";

const {Item} =List;

class PaySuccess extends Component {
    constructor(props) {
        super(props);
        this.state={

        }
    }

    componentWillMount(){
        this.props.dispatch({type:"orderList/RecommendsEFF"})
    }


    render() {
        const {dispatch} =this.props;
        const {list=[]} = this.props.orderList;
        console.log(list, "list");

        return (
            <Flex style={{
                height:"100%",
                width:"100%"
            }} direction="column"
            >
                <NavTopBar dispatch={dispatch} title="支付成功"/>
                <MyScroll>
                    <div style={{backgroundColor:"#fff"}}>
                        <Flex justify="center">
                            <Icon type={paySuccesssvg.id} style={{width:"1rem",height:"1rem",marginRight:".6rem"}}/>
                            <div style={{padding:".4rem 0"}}>
                                <p>订单 (或充值) 编号: {this.props.match.params.data.split(",")[2]}</p>
                                <p>支付金额 : <span style={{color:"#ff0036"}}>¥{this.props.match.params.data.split(",")[0]}</span></p>
                            </div>
                        </Flex>
                        <Flex justify="around" style={{paddingBottom:".4rem"}}>
                            <Link to="/" style={{padding:".15rem .2rem",border:"1px solid #333",borderRadius:".5rem"}}>返回首页</Link>
                            <div style={{padding:".15rem .2rem",border:"1px solid #ff0036",borderRadius:".5rem",color:"#ff0036"}} onClick={()=>{
                                this.props.dispatch(routerRedux.push({
                                    pathname:`/orderList/2`
                                }))
                            }}>查看订单</div>
                        </Flex>
                    </div>
                    <RecommendGoods data={list} dispatch={dispatch}/>
                </MyScroll>

            </Flex>
        );
    }
}

export default connect(({ orderList }) => ({ orderList }))(PaySuccess);
